﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Runtime.InteropServices;
using System.Windows.Interop;

namespace Kinect_Interface_Prototype_1.Voice_Commands
{
    /// <summary>
    /// Interaction logic for confirmationWindow.xaml
    /// </summary>
    public partial class confirmationWindow : Window
    {
        private const int GWL_STYLE = -16;
        private const int WS_SYSMENU = 0x80000;
        [DllImport("user32.dll", SetLastError = true)]
        private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
        [DllImport("user32.dll")]
        private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

        public string command = "";

        private StartupProgram MainProgram;


        public confirmationWindow()
        {
            InitializeComponent();
        }

        public confirmationWindow(StartupProgram program)
        {
            InitializeComponent();
            MainProgram = program;
        }

        public void No_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            this.Hide();
        }

        public void Yes_Click(object sender, EventArgs e)
        {
            switch (command)
            {
                case "logoff":

                    // do work here
                    textBox1.Text = command;
                    break;
                case "shutdown":
                    // do work here
                    textBox1.Text = command;
                    break;
                case "restart":
                    // do work here
                    textBox1.Text = command;
                    break;
                case "Hibernate":
                    // do work here
                    textBox1.Text = command;
                    break;
                case "exit":
                    MainProgram.ShutDown();
                    break;
                default:
                    break;
            }
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
           // textBox1.Text = command;
            var hwnd = new WindowInteropHelper(this).Handle;
            SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);

        }
    }
}
